﻿/**
* Class:  
* Version: alpha
* Author:  Pavel Jacko
* Date:   18/05/2009
* Description:
* 
*/
package syerit.core.display
{
	import flash.display.Shape;
	import flash.display.GradientType;
	import flash.geom.Matrix;
	import flash.display.SpreadMethod;


	public class GradientShape extends Shape
	{
		public function GradientShape (_w:Number,_h:Number,_colors:Array,_raitos:Array,_alphas:Array,_rot:Number=0)
		{
			var colors:Array = _colors;
			var alphas:Array = _alphas;
			var ratios:Array = _raitos;
			var matrix:Matrix = new Matrix();
			var $rot:Number=Math.PI/(180/_rot)
			  matrix.createGradientBox(_w, _h, $rot, 0, 0);
 			 var spreadMethod:String = SpreadMethod.PAD;
			graphics.beginGradientFill (GradientType.LINEAR,
			                                colors,
			                                alphas,
			                                ratios,
			                                matrix,spreadMethod);

			graphics.drawRect (0, 0, _w, _h);
			graphics.endFill ();
		}
	}
}